<%-- 
    Document   : viewMember
    Created on : Jun 3, 2014, 1:01:13 PM
    Author     : Phan Van Duong
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>DVD Shop Online - View Member</title>
    </head>
    <body>
        <h1>View Member</h1>
        <form action="MemberController?task=searchMember" method="post">
            <input name="txtSearch"/><input type="submit" value="Search"/>
        </form>
        <c:set var="members" value="${sessionScope.MEMBERS}"/>
        <c:if test="${not empty members}">
            <p>Result Search</p>
            <table border="1">
                <thead>
                    <tr>
                        <td>ID</td>
                        <td>Username</td>
                        <td>Password</td>
                        <td>Phone</td>
                        <td>Birthday</td>
                        <td>Sex</td>
                        <td>Address</td>
                        <td>Join Date</td>
                        <td>Status</td>
                        <td>Action</td>
                    </tr>
                </thead>
                <tbody>
                    <c:forEach var="member" items="${members}">
                        <tr>
                            <td>${member.userId}</td>
                            <td>${member.username}</td>
                            <td>${member.password}</td>
                            <td>${member.phone}</td>
                            <td>${member.birthday}</td>
                            <td>${member.sex}</td>
                            <td>${member.address}</td>
                            <td>${member.joinDate}</td>
                            <td>
                                <c:if test="${member.status eq '1'}">
                                    Active
                                </c:if>
                                <c:if test="${member.status eq '2'}">
                                    Pause
                                </c:if>
                                <c:if test="${member.status eq '3'}">
                                    Delete
                                </c:if>
                            </td>
                            <td>
                                <c:url var="edit" value="editMember.jsp">
                                    <c:param name="userId" value="${member.userId}"/>
                                    <c:param name="username" value="${member.username}"/>
                                    <c:param name="password" value="${member.password}"/>
                                    <c:param name="phone" value="${member.phone}"/>
                                    <c:param name="birthday" value="${member.birthday}"/>
                                    <c:param name="sex" value="${member.sex}"/>
                                    <c:param name="address" value="${member.address}"/>
                                    <c:param name="joindate" value="${member.joinDate}"/>
                                    <c:param name="status" value="${member.status}"/>
                                </c:url>
                                <a href="${edit}">Edit</a>                                
                            </td>
                        </tr>
                    </c:forEach>
                </tbody>
            </table>
        </c:if>
    </body>
</html>
